package script.grammar.expression;

import script.grammar.symbol.NativeType;
import script.grammar.symbol.Type;

public class IncDecOperator extends UnaryOperator {
	private final String name;
	
	public IncDecOperator(String name) {
		this.name = name;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	protected Type computeTypeImpl(Type operand) {
		if (operand.equals(NativeType.INT) || operand.equals(NativeType.DOUBLE)) {
			return operand;
		} else {
			return NativeType.BOOLEAN;
		}
	}
}
